package com.caiyi.financial.nirvana.sms.controller;

import com.caiyi.financial.nirvana.sms.enums.ReturnCodeEnum;
import com.caiyi.financial.nirvana.sms.querybean.QueryUserBean;
import com.caiyi.financial.nirvana.sms.service.SmsRegisterUserService;
import com.youyu.common.api.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@Api(description = "用户审核接口")
@CrossOrigin
@RestController
@RequestMapping("sms/admin/register")
public class RegisterUserController {

    protected Logger logger = LoggerFactory.getLogger(this.getClass());

    @Autowired
    private SmsRegisterUserService registerUserService;

    @ApiOperation(value = "查询所有注册信息", notes = "查询所有注册信息")
    @ApiImplicitParam(name = "bean", value = "查找客户参数实体", required = true, dataType = "QueryUserBean")
    @PostMapping("/getRegisterUserList")
    public Result getRegisterUserList(@RequestBody QueryUserBean bean) {
        return Result.ok(registerUserService.selectRegisterUserList(bean));
    }

    @ApiOperation(value = "一键开户", notes = "一键开户")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "id", value = "用户id", required = true, dataType = "int", paramType = "query")
    })
    @PostMapping("/openAccount")
    public Result openAccount(Integer id) {
         registerUserService.openAccount(id);
         return Result.ok();
    }

    @ApiOperation(value = "审核驳回", notes = "审核驳回")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "id", value = "用户id", required = true, dataType = "int", paramType = "query"),
            @ApiImplicitParam(name = "remark", value = "驳回原因", required = true, dataType = "String", paramType = "query")
    })
    @PostMapping("/reject")
    public Result reject(Integer id, String remark) {
         registerUserService.reject(id, remark);
         return Result.ok();
    }

}
